export default {
	data() {
		return {
			pagation: this.$config.pagation,
			param:{
				
			}
		}
	},
	methods: {
		getData(param) {
			let {
				pagation
			} = this
			if(param) this.param = {
				...this.param,
				...param
			}
			if (param === 'all') this.pagation.pageIndex = 1 //查询全部
			if (param === 1) this.pagation.pageIndex++
			if (param && param.keyword) pagation.pageIndex = 1 //搜索页面改为1
			return this.$http.get('/api/goods/list', {
				...pagation,
				...this.param
			})
		},
		getGoods(id) {
			return this.$http.get('/api/goods/detail', {
				id
			})
		},
		handleColled(id, isColled = false) {
			return isColled ?
				this.$http.post('/api/collection/remove', {
					id
				}) : this.$http.post('/api/collection/add', {
					id
				})
		}
	}
}
